/***************************************************************************
 *   Copyright (C) 2009 by Aleksey,,,   *
 *   libactaeon@gmail.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as       *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU Library General Public     *
 *   License along with this program; if not, write to the                 *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef __IMAGE_H__
#define __IMAGE_H__

namespace Actaeon
{

	/*
   * Describes how an image is packed into a block of a memory.
	 * IPF_RGB8: 8 bits of red, green, then blue.  (Blue in least significant byte).
	 * IPF_BGR8: 8 bits of blue, green, then red.  (Red in least significant byte).
	 * IPF_ARGB8: 8 bits of alpha, red, green, then blue (Blue in least significant byte).
	 * IPF_ABGR8: 8 bits of alpha, blue, green, then red (Red in least significant byte).
	 * IPF_XRGB5: sixteen bits per pixel, the most significant bit being junk, then 5 bits of red, green, and blue (least significant).
	 * IPF_PAL8: An 8 bit unsigned index into a palette.
   */
	enum ImagePackingFormat
	{
		IPF_RGB8,
		IPF_BGR8,
		IPF_ARGB8,
		IPF_BGRA8,
		IPF_XRGB5,
		IPF_PAL8
	};

	/*
   * Represents a bitmapped image that can be loaded from a file.
   * @brief A bitmap loaded from a file.
   */
	class Image
	{
	public:
		Image();
		Image(const char *filepath);
		Image(const char *filepath, int packingConstraint);
	public:
		void *getData();
		int getWidth();
		int getHeight();
		int getPackingFormat();
	private:
		void repack(int newFormat);
	private:
		int width, height;
		int packingFormat;
		void *data;		
	};

}

#endif
